package com.smartwebee.android.blespp.http;

import android.util.Log;

import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.smartwebee.android.blespp.utils.UIUtils;

/**
 * Created by steward on 2018/7/11.
 */

public class HttpCallback implements Response.ErrorListener, Response.Listener<String> {
    private String TAG = "HttpCallback";
    protected RequestInterface requestInterface;
    protected String id;

    public HttpCallback(RequestInterface requestInterface, String id) {
        this.requestInterface = requestInterface;
        this.id = id;
    }

    @Override
    public void onErrorResponse(VolleyError error) {
        requestInterface.onError(error.toString());
        Log.i(TAG + " " + id, error.toString());
    }

    @Override
    public void onResponse(String response) {
        requestInterface.onSuccess(id, response);
        Log.i(TAG + " " + id, response);
    }
}
